'use strict';

const fs = require('fs');
const path = require('path');

module.exports = appInfo => {
    const config = {};

    // should change to your own
    config.keys = appInfo.name + '_1489816290616_7711';


    config.siteFile = {
        '/favicon.ico': fs.readFileSync(path.join(appInfo.baseDir, 'app/public/favicon.png')),
    };

    config.view = {
        defaultViewEngine: 'nunjucks',
        mapping: {
            '.tpl': 'nunjucks',
        },
    };

    config.redis = {
        client: {
            host: '10.66.192.2',
            port: '6379',
            password: 'languo123456',
            db: '0',
        },
    };

    config.sessionRedis = {
        name: '', // single redis does not need to config name
    };

    config.sequelize = {
        dialect: 'mysql', // support: mysql, mariadb, postgres, mssql
        database: 'tftime',
        host: '10.66.220.207',
        port: '3306',
        username: 'root',
        password: 'languo123456',
    };

    config.weappSDK = {
        appId: 'wx9d0d786042e82a39', // your weapp appId
        appSecret: '3cfce5f7e4f323b15b257b2792cc36b2', // weapp appSecret
    };

    config.security = {
        csrf: {
            ignoreJSON: true, // 默认为 false，当设置为 true 时，将会放过所有 content-type 为 `application/json` 的请求
        },
    };

    // Qcloud Cloud Object Storage
    config.cos = {
        secretId: 'AKIDGRXYP48qwysb8TDZ7XloiQw0xkOulRT2',
        secretKey: 'Xt20qUpNm26yfAVfeQ4WmCTbZLwKkBVj',
        appId: '1254029980',
        bucket: 'test1',
        folder: 'test1-1',
    };

    return config;
};